<template>

  <el-container>
    <el-header>
      <h1>银行转账管理系统</h1>
      <div class="logout">
        卡号：<span>{{this.cardNo}} </span>
        <el-button type="danger"
                   icon="el-icon-close"
                   circle
                   @click="logout"></el-button>
      </div>

    </el-header>
    <el-container>
      <el-aside :width="isCollapse?'66px':'200px'">
        <div class="doCollapse"
             @click="hesCollapse">
          |||
        </div>
        <el-menu :collapse="isCollapse"
                 :router="true"
                 :collapse-transition="false"
                 unique-opened
                 @open="handleOpen"
                 @close="handleClose"
                 background-color="#D3DCE6"
                 text-color="#000"
                 active-text-color="#000">
          <el-menu-item index="balance">
            <i class="el-icon-s-help"></i>
            <span slot="title">查询余额</span>
          </el-menu-item>
          <el-menu-item index="accounts">
            <i class="el-icon-s-promotion"></i>
            <span slot="title">转账</span>
          </el-menu-item>
          <el-menu-item index="record">
            <i class="el-icon-document"></i>
            <span slot="title">查询交易记录</span>
          </el-menu-item>
          <el-menu-item index="password">
            <i class="el-icon-setting"></i>
            <span slot="title">修改密码</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>

        <div class="main">
          <router-view>
          </router-view>
        </div>
      </el-main>

    </el-container>
  </el-container>

</template>

<script>
import Menu from '../../components/Menu/index.vue'
export default {
  data () {
    return {
      isCollapse: false,
      cardNo: localStorage.getItem('cardNo'),
      password: localStorage.getItem('password')
    }
  },
  components: {
    Menu,
  },
  methods: {
    hesCollapse () {
      this.isCollapse = !this.isCollapse;
    },
    handleOpen (key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath);
    },
    hesCollapse () {
      this.isCollapse = !this.isCollapse;
    },
    logout () {
      localStorage.removeItem('cardNo')
      localStorage.removeItem('password')
      this.$router.push("/")
    }



  },
}
</script>

<style lang="less">
.el-container {
  height: 100%;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
}

.el-aside {
  background-color: #d3dce6;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}
.main {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

body > .el-container {
  margin: 0;
  height: 100vh;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
.doCollapse {
  text-align: center;
  color: #999;
  padding: 15px 0 10px 0;
}
.logout {
  position: absolute;
  right: 20px;
}
</style>
